<!DOCTYPE html>
<html>
<head>
<script src="resources/recv.js"></script>
<script>
if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
}

addEventListener("message", recv, false);

function test() {
    var iframe = document.getElementById('child');
    var win = iframe.contentWindow;
    win.postMessage('Message from parent', '*');

    win.postMessage('done', '*');
}
</script>
<base href="http://www.example.com/">
<body onload="test()">
<div>window.location.href = <script>document.write(window.location.href);</script></div>
<div><iframe src="http://localhost:8000/security/postMessage/resources/post-message-listener.html"
  id="child" width="800" height="300" style="border: 1px solid black;">
</iframe></div>
<div id="result">waiting...</div>
</body>
</html>

